package com.lesshassles.controller;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.lesshassles.model.Task;

public class TaskCreateValidator implements Validator {
	
	public boolean supports(Class aClass) {
		return aClass.equals(Task.class);
	}

	public void validate(Object command, Errors errors) {
		
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "assignedTo", "error.taskCreate.required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "error.taskCreate.required");
	}
}
